<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="lib/vue-2.4.0.js"></script>
</head>
<body>
<div id="app">
    <input type="button" value="点击" @click="getelement"/>
    <h3 ref="myh3">哈哈哈哈哈哈哈哈</h3>
    <hr>
    <login ref="mylogin"></login>
</div>
<script>
    var login  = {
        template:'<h1>登录组件</h1>',
        data:function(){
            return{
                msg:'son   msg'
            }

        },
        methods:{
            show:function () {
                console.log('这是子组件的方法')
            }
        }
    }
    var vm = new Vue({
        el:'#app',
        data:{},
        methods:{
            getelement:function () {
//                $refs  值类型  或  引用类型
//                console.log(this.$refs.myh3.innerText);
//                console.log(this.$refs.mylogin.msg);
                this.$refs.mylogin.show();
            }
        },
        components:{
           login

        }
    })
</script>
</body>
</html>